<?
session_start();
if(!session_is_registered("myusername")){
    header("location:index.php");
}
else{
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Notation des commerces de Mons >> Vos notes</title>
        <link rel="stylesheet" href="./mystyle.css" type="text/css" media="screen" />
    </head>
    <body>
       <?
        include 'myheader.php';
       ?>
        <center>

            <?php
            session_start();

            include 'connect_db.php';

            //USERID
            $sql="SELECT idusers FROM users_site WHERE email_adress='$myusername'";
            $result1=mysql_query($sql);
            $count=mysql_num_rows($result1);
            if($count==1){
                while($tableau1=mysql_fetch_array($result1,MYSQL_ASSOC)){
                    $userid =   $tableau1['idusers'];
                    //echo "userID:";
                    //echo $userid;
                }
            }

            echo "<h2>Vos notes:</h2>";
            echo "<div id='colonne1' align='center' class='colonnem'>";
            $sql="SELECT ratings.rating as 'sum_r',items.name,items.street,items.number,cities.zip,cities.name as 'cityname'
                                                    from items
                                                    INNER JOIN ratings ON ratings.items_iditems=items.iditems
                                                    INNER JOIN cities ON cities.idcities=items.cities_idcities
                                                    WHERE ratings.users_idusers=".$userid.
                                                    " ORDER BY ratings.rating DESC";
            $result1=mysql_query($sql);

            echo "<TABLE BORDER=0>";

            echo '<TR><TD><b>Votre note</b></TD><TD><b>Nom</b></TD><TD><b>Adresse</b></TD><TD><b>Code postal</b></TD><TD><b>Ville</b></TD></TR>';

            while($tableau1=mysql_fetch_array($result1,MYSQL_ASSOC)){
                echo '<TR><TD>',$tableau1['sum_r'],'</TD><TD>',$tableau1['name'],'</TD><TD><small>',$tableau1['street'],',',$tableau1['number'],'</small></TD><TD><small>',$tableau1['zip'],'</small></TD><TD><small>',$tableau1['cityname'],'</small></TD>';
            }
            echo '</TABLE>';
            echo '</div>';

            mysql_close($link);
            ?>
        </center>
    </body>
</html>